//生成菜单
var menuItem = Vue
    .extend({
        name : 'menu-item',
        props : {
            item : {}
        },
        template : [
            '<li>',
            '<a class="aaa" target="main" href="javascript:void(0);" :data_url="item.url"><i v-if="item.icon != null" :class="item.icon"></i><i v-else class="fa fa-circle-o"></i> <span>{{item.name}}</span><br/><span>{{item.e_name}}</span></a>',
            '</li>' ].join('')
    });


// 注册菜单组件
Vue.component('menuItem', menuItem);

var vm = new Vue({
    el:"#homeVue",
    data:{
        menuList:[
            {
                "icon":"fa fa-folder",
                "name":"首页",
                "e_name":"home",
                "url":"html/indexHome.html"
            },
            {
                "icon":"fa fa-folder",
                "name":"商品管理",
                "e_name":"Commodity management",
                "url":"html/supply/supply.html"
            },
            {
                "icon":"fa fa-folder",
                "name":"交易统计",
                "e_name":"Transaction",
                "url":"html/transaction/transaction.html"
            },
            {
                "icon":"fa fa-folder",
                "name":"我的订单",
                "e_name":"My Order",
                "url":"html/myOrder/myorder.html"
            },
            {
                "icon":"fa fa-folder",
                "name":"我的",
                "e_name":"Mine",
                "url":"html/notification/notification.html"
            },
            {
                "icon":"fa fa-folder",
                "name":"开关店铺",
                "e_name":"Switch shop",
                "url":"html/supply/supply.html"
            },
        ],
        navTitle:"首页",
        e_navTitle:"Home",
        main:"html/indexHome.html",
    },
    methods:{
    }
});

$(function(){
    $("#sidebar-menu li  a").on("click",function(){
        var url = $(this).attr("data_url");
        vm.main = url;
        var text = $(this).find("span").eq(0).text();
        var text1 = $(this).find("span").eq(1).text();
        console.log($("#title_span"));
        vm.navTitle = text;
        vm.e_navTitle = text1;
        $("#sidebar-menu li").removeClass("active");
        $(this).parent("li").addClass("active");
    })
    $("#sidebar-menu li").eq(0).addClass("active");
})
function areaEdit(){
    vm.main = "html/shop/shop.html?type=2";
}
function basic(){
    vm.main = "html/shop/shop.html?type=1";
}